<template>
  <el-config-provider :locale="locale">
    <component :is="resolveLayout">
      <router-view></router-view>
    </component>
  </el-config-provider>
</template>
<script>
import { computed } from "vue";
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/es/locale/lang/zh-cn";
import en from "element-plus/es/locale/lang/en";
import LayoutBlank from "@/layout/blank.vue";
import LayoutContent from "@/layout/content.vue";
import { useRoute } from "vue-router";
import { defaultLang } from "@/locales";
export default {
  name: "App",
  components: {
    LayoutBlank,
    LayoutContent,
  },
  setup() {
    const route = useRoute();
    const resolveLayout = computed(() => {
      let str = "LayoutBlank";
      if (!route.name) return null;

      if (route.meta.layout === "blank") {
        str = "LayoutBlank";
      } else {
        str = "LayoutContent";
      }
      return str;
    });

    let locale = defaultLang == "zh-CN" ? zhCn : en;
    return { resolveLayout, locale };
  },
};
</script>
<style>
#app {
  background-image: url("@/assets/images/common/bg.jpg");
  background-size: 100% 100%;
}
</style>
